<?php
/**
 * The template for displaying Home page.
 *
 * @file      index.php
 * @package   autodaily news
 * @author    Chinh Tran
 * 
 **/
?>
<?php get_header(); ?>
<div class="body">
    <div class="top-news-home">
		<div class="left">
			<div class="home-slide">
				<div class="coda-slider-wrapper fl">
		<div class="coda-slider preload" id="coda-slider-1" style="width: 1500px;">
        
            <?php $args = array(
                    	'posts_per_page'      => 3,
                    );
                $the_query = new WP_Query($args);
                // The Loop
                if ( $the_query->have_posts() ) {
                	
                	while ( $the_query->have_posts() ) {
                		$the_query->the_post();
                        ?>
                 <div class="panel">
					<div class="panel-wrapper active-holder">
						<a href="<?php esc_url(the_permalink())?>" class="img_feature" style="display: block; background-image: url(<?php echo get_bg_image(get_the_ID());?>)"><?php if ( has_post_thumbnail() ) { the_post_thumbnail('featured-thumb');} else { echo get_default_image();} ?> </a>
						<a href="<?php esc_url(the_permalink())?>">
							<p class="title">
								<label>&nbsp;</label><?php the_title() ?>
							 <span class="clear"></span> 
							</p>
							<div class="sapo"><?php the_excerpt(); ?></div>
						</a>
					</div>
				</div>
              <?php          
                	}
                 } 
                /* Restore original Post Data */
                //wp_reset_postdata();
            
            ?>
			
		</div>
		<!-- .coda-slider -->
		<div class="nav-wrapper">
			<div id="coda-nav-left-1" class="coda-nav-left"><a href="#" title="Slide left"><img src="<?php echo get_template_directory_uri(); ?>/images/nav-prev.png" alt="prev buttom" /></a></div>
			<div id="coda-nav-1" class="coda-nav">
				<ul>
                <?php // The Loop
                if ( $the_query->have_posts() ) {
                	
                	while ( $the_query->have_posts() ) {
                		$the_query->the_post();
                ?>
                    <li class="tab1">
                        <a href="<?php esc_url(the_permalink())?>" class="coda_img" style="display: block; background-image: url(<?php echo get_bg_image(get_the_ID());?>)"> 
                            <?php if ( has_post_thumbnail() ) {the_post_thumbnail('featured-thumb-small');} else { echo get_default_image(129, 72);} ?> 
                        </a>
                    </li>
                <?php          
                	}
                 } 
                /* Restore original Post Data */
                wp_reset_postdata();
            
                 ?>	
				</ul>
			</div>
			<div id="coda-nav-right-1" class="coda-nav-right"><a href="#" title="Slide right"><img src="<?php echo get_template_directory_uri(); ?>/images/nav-next-active.png" alt="next buttom"/></a></div>
		</div>
	</div>            <!-- .coda-slider-wrapper -->
				<div class="clear"></div>
			</div>
			<div class="list-top-news">
					<style>
						.list-top-news .item {
							border-left: 9px #c8c8c8 solid;
							width: 181px;
							height: 386px;
							overflow: hidden;
						}
					</style>
					<a href="#" title="Triển lãm Ô tô - VMS2014">
											<img src="<?php echo get_template_directory_uri(); ?>/images/logo-be811-02.jpg" width="190" alt="Triển lãm Ô tô - VMS2014"/>
					</a>
					<div class="datetime"><?php echo  sw_get_current_weekday(); ?></div>
					<ul class="item">
                        <?php $args = array(
                                	'posts_per_page'      => 8,
                                );
                            $the_query = new WP_Query($args);
                            // The Loop
                            if ( $the_query->have_posts() ) {
                            	
                            	while ( $the_query->have_posts() ) {
                            		$the_query->the_post();
                                    ?>
                             <li><a href="<?php esc_url(the_permalink())?>"><?php the_title() ?> </a></li>
                          <?php          
                            	}
                             } 
                            /* Restore original Post Data */
                            wp_reset_postdata();
                        
                            ?>
							
					 </ul>        
			</div>
		</div>
		<div class="right">
			<div id="banner3double">
				<div class="banner-home-3A" id="banner3a" style="margin-bottom: 8px;background: #cccccc;min-height: 250px;width: 300px;"></div>
				<div class="banner-home-3B" id="banner3b" style="background: #cccccc;min-height: 250px;width: 300px;"></div>
			</div>
		</div>
		<div class="clear"></div>
	</div>
    <!--End top new home -->
    <div class="home-middle">
    <div class="home-review">
        <p class="title">
    <a href="#">ĐÁNH GIÁ XE
        <img src="<?php echo get_template_directory_uri(); ?>/images/red-star.png"/>
        <img src="<?php echo get_template_directory_uri(); ?>/images/red-star.png"/>
        <img src="<?php echo get_template_directory_uri(); ?>/images/red-star.png"/>
        <img src="<?php echo get_template_directory_uri(); ?>/images/red-star.png"/>
        <img src="<?php echo get_template_directory_uri(); ?>/images/red-star.png"/>
    </a>
</p>
<div class="list-reviews" >
    <?php $args = array(
               'category_name'      => 'danh-gia',
               'posts_per_page'      => 5,
          );
          $the_query = new WP_Query($args);
          // The Loop
          if ( $the_query->have_posts() ) {
                            	
              while ( $the_query->have_posts() ) {
                    $the_query->the_post();
    ?>
                    <div class="item">
                        <a href="<?php esc_url(the_permalink())?>" class="item_img" style="display: block; background-image: url(<?php echo get_bg_image(get_the_ID());?>)">
                            <?php if ( has_post_thumbnail() ) { the_post_thumbnail('review-thumb');} else { echo get_default_image(199, 111); } ?>
                		</a>
                
                        <div class="review-title">
                            <a href="<?php esc_url(the_permalink())?>"><?php the_title()?></a>
                            <div class="social">
                                <div class="share-link">
                                    <a class="alinkHomen" onmousemove="focusshare('share<?php the_ID();?>', '<?php esc_url(the_permalink())?>')">
                                        <img src="<?php echo get_template_directory_uri(); ?>/images/ic_share.png"/>
                                    </a>
                                    <div class="ulchildShare" id="share<?php the_ID();?>" style="display: none;">
                					</div>                       
                                </div>
                            </div>
                        </div>
                    </div>
    <?php          
                }
            } 
        /* Restore original Post Data */
        wp_reset_postdata();
                        
    ?>
   
    </div>
	<div class="clear"></div>    
    </div>
   
    </div><!--End home middle -->
 <div class="home-main">
    <div class="left">
        <div class="list-news" style="min-height: 2054px;">
            <div class="title">
                <a href="#" class="active" >TIN MỚI</a>
                <a   href="#">XE MỚI</a>
                <a  href="#">AUTODAILY PHOTOS</a>
                <a  href="#">VIDEOS</a>
            </div>
            <div class="list-items">
                <ul>
                <?php $args = array(
                           'posts_per_page'      => 18,
                           'orderby'             => 'date',
                           'order'               => 'DESC',   
                      );
                      $the_query = new WP_Query($args);
                      // The Loop
                      if ( $the_query->have_posts() ) {
                                        	
                          while ( $the_query->have_posts() ) {
                                $the_query->the_post();
                ?>
                                <li>
                                    <a href="<?php esc_url(the_permalink())?>" class="link-img-thumb" style="display: block; background-image: url(<?php echo get_bg_image(get_the_ID());?>)">
                                          <?php the_post_thumbnail('article-thumb'); ?>
                                    </a>
                                    <a href="<?php esc_url(the_permalink())?>"><?php the_title()?></a>
                                    <div class="sapo"><?php the_excerpt(); ?></div>
                                    
                                    <div class="extra"><span class="datetime"><?php echo get_the_date( 'H:i | d/m/Y' ); ?></span>
                                        <div class="social">
                                            <div class="share-link">
                                                <a class="alinkHomen" onmousemove="focusshare('share<?php the_ID()?>', 'http://autodaily.vn/2014/11/oto-cang-dat-cang-ban-chay-tay-choang-dan-viet-choi-xe-sang/')">
                                                    <img src="<?php echo get_template_directory_uri() ?>/images/ic_share.png"/>
                                                </a>
                                                <div class="ulchildShare" id="share<?php the_ID()?>" style="display: none;">
                                
                                                </div>                       
                                            </div>
                                        </div>
                                    </div>
                                    <div class="clear"></div>
                                </li>
                <?php          
                            }
                            wp_paginate();
                        } 
                    /* Restore original Post Data */
                    wp_reset_postdata();
                                    
                ?>
                    
            </ul>
    </div>

    <!--div class="paginator">
         <li class="page_info">Trang 0 / 9284</li>
         <ul id="yw0" class="yiiPager"><li class="first hidden"><a href="#">&lt;&lt; Đầu tiên</a></li>
            <li class="previous hidden"><a href="#"><img src="<?php echo get_template_directory_uri() ?>/images/arrow-left.png"></a></li>
            <li class="page selected"><a href="#">1</a></li>
            <li class="page"><a href="#">2</a></li>
            <li class="page"><a href="#">3</a></li>
            <li class="page"><a href="#">4</a></li>
            <li class="page"><a href="#">5</a></li>
            <li class="page"><a href="#">6</a></li>
            <li class="page"><a href="#">7</a></li>
            <li class="page"><a href="#">8</a></li>
            <li class="page"><a href="#">9</a></li>
            <li class="page"><a href="#">10</a></li>
            <li class="next"><a href="#"><img src="<?php echo get_template_directory_uri() ?>/images/arrow-right.png"></a></li>
            <li class="last"><a href="#">Cuối &gt;&gt;</a></li>
         </ul>            
    </div-->
</div>
    <div class="misc" style="min-height: 1800px; background: #ffffff">
        <div class="top-view">
            <div class="title"><a href="">XEM NHIỀU NHẤT</a></div>
            <div class="first-news">
                <a href="#">
                    <img src="<?php echo get_template_directory_uri() ?>/images/honda-moove.jpg" width="162" height="91" />
                </a>
                <a href="#">Honda ra mắt xe tay ga thông minh, giá rẻ</a>
             
            </div>
                    
            <ul>
            <?php $args = array(
                           'posts_per_page'      => 9,
                           'meta_key'            => 'post_views_count',
                           'orderby'             =>  'meta_value_num',
                           'order'               => 'DESC',   
                    );
                    
            	   $the_query = new WP_Query($args);
                    // The Loop
                    if ( $the_query->have_posts() ) {
                        while ( $the_query->have_posts() ) {
                                $the_query->the_post();
                    ?>
                            <li><a href="<?php esc_url(the_permalink())?>"><?php the_title()?></a></li>        
                    <?php          
                            }
                    } 
                        /* Restore original Post Data */
                        wp_reset_postdata();
                                    
                    ?>
                
            </ul>
            <!--a href="#" class="more-news">CÁC TIN KHÁC</a-->
        </div>
        <div class="survey">
        </div>

    </div>
</div>
<div class="right">
    <div class="banner-300px banner-home-5A" style="margin-top: 0;">
        <div id="banner6a"></div>
    </div>
    <div class="fb-like-box" data-href="https://www.facebook.com/congdongautodaily" data-width="300" data-colorscheme="light" data-show-faces="true" data-header="true" data-stream="false" data-show-border="true" style="margin-bottom: 8px;"></div>
    <div class="home-video">
        <div class="title"><a href="#">VIDEOS</a></div>
        <div class="content">
            <p class="video-title"> <a href="#">Xem chiếc xe lộn ngược đi kiểu gì?</a> </p>
            <iframe style="position: relative" width="300" height="250" src="http://www.youtube-nocookie.com/embed/7rKPsFpJGqo?&rel=0" frameborder="0" allowfullscreen></iframe>
            <p class="video-item"> <a href="#">Mercedes-Benz giới thiệu siêu phẩm concept tuyệt đẹp</a> </p>
            <p class="video-item"> <a href="#">Xem ôtô bay có giá 6 tỷ đồng</a> </p>
            <p class="video-item"> <a href="#">Xem Porsche 991 tự động nâng gầm</a> </p>
        </div>        
    </div>

    <div class="banner-300px banner-home-5B">
        <div id="banner6b"></div>
    </div>

</div>
</div><!--End home main-->
<div class="clear"></div>
</div>
	
<?php get_footer(); ?>